#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
    面向对象测试
    @Author 黄海峰
    @Date 2021/4/14 17:13
    @Version 1.0.0
"""


# object 表示 Student是从哪个类继承下来的
# __init__ 下划线别是特殊方法，类似__init__是可以直接调用的，不建议如此命名
class Student(object):

    def __init__(self, name, score):
        self.name = name
        self.score = score

    def print_score(self):
        print('%s的成绩是：%s' % (self.name, self.score))

    def run(self):
        print('我是父类的实现')


dean = Student('DEAN', 100)
print(dean.print_score())


class GoodStudent(Student):
    pass


good = GoodStudent('dean', 90)
print(good.run())


class GoodStudent2(Student):
    def run(self):
        print('我是子类实现')


good2 = GoodStudent2('dean', 90)
print(good2.run())

# 由继承引发的多态
a = GoodStudent2('dean', 20)
print(isinstance(a, Student))

a = -1


def test_not():
    if not a > 0:
        print('aa')


print(test_not())


# 多重继承
class Teacher(object, Student):
    pass
